<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Post.aspx.cs" Inherits="Post" Title="Untitled Page" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="Decav.Gatsb.Web" Namespace="Decav.Gatsb.Web.Controls" TagPrefix="gatsb" %>
<%@ Register Src="~/UserTileControl.ascx" TagPrefix="decavuc" TagName="UserTile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeaderPlaceholder" Runat="Server">

<script language="javascript" type="text/javascript">
// <!--
    function ChangeImage(imgName)
    {
        var mainImg = document.getElementById("<%= postImage.ClientID %>");
        mainImg.src = "Images/Svr/or_" + imgName + ".jpg";
        
        return mainImg;
    }
// -->
</script>
<link rel="stylesheet" type="text/css" href="Styles/TwoColumnRightStyle.css" />
<link rel="stylesheet" type="text/css" href="Styles/PostStyle.css" />

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageBodyPlaceholder" Runat="Server">
     <h1>@<gatsb:GatsbLocationLink runat="server" id="locationLink" /> <asp:Literal runat="server" ID="headerTimeLiteral" /></h1>
     <gatsb:NotLoggedInRibbonControl ID="NotLoggedInRibbonControl1" runat="server" />
     
     <div class="ColumnRight">
        <div class="UserTileFrame">
            <decavuc:UserTile runat="server" id="postingUserTile" />
        </div>
        <asp:Repeater runat="server" ID="imageRepeater">
            <HeaderTemplate>
                <div class="OtherPicturesFrame">
                <h3>Other Pictures</h3>
                <ul class="PostImageList">
            </HeaderTemplate>
            <ItemTemplate>
                <li><a href="<%# System.String.Format("Images/Svr/or_{0}.jpg", Eval("Id")) %>"
                    onclick="<%# System.String.Format("ChangeImage('{0}');return false;", Eval("Id")) %>"><img
                        src="<%# System.String.Format("Images/Svr/th_{0}.jpg", Eval("Id")) %>" alt="" /></a>
                </li>
            </ItemTemplate>
            <FooterTemplate>
                </ul>
                </div>
            </FooterTemplate>
        </asp:Repeater>
     </div>
     <div class="ColumnMain">
         <div class="Blockquote" runat="server" id="postBody">
            <blockquote>
                <asp:Literal runat="server" ID="postBodyLiteral" />
            </blockquote>
         </div>     
         <div class="postImageFrame">
            <img src="#" alt="" id="postImage" runat="server" />
         </div>
         
         <a name="Comments" style="display:none;" title="Post Comments"></a>
         <div class="PostComments">
            <h3>Comments</h3>
             <asp:UpdatePanel runat="server" ID="commentsUpdatePanel">
                <ContentTemplate>
             <asp:Panel runat="server" ID="postCommentFormPanel">
                 <div class="ErrorRibbon" id="commentErrorDiv" runat="server" visible="false">
                    Leaving comments is good, but you need to enter some text so that we can post it up here.
                 </div>
                 <div id="CommentPostForm">
                    <p>
                     <cc1:TextBoxWatermarkExtender ID="commentTextBoxWatermark" runat="server" WatermarkCssClass="TextBoxWatermark"
                        TargetControlID="commentTextBox" WatermarkText="Leave some love..." />
                    <asp:TextBox runat="server" ID="commentTextBox" TextMode="multiLine" />
                    </p>
                    <p>
                        <asp:Button runat="server" ID="submitCommentButton" OnClientClick="this.enabled=false" OnClick="SubmitCommentButton_Click" Text="Post" />
                    </p>
                 </div>
             </asp:Panel>
             <div id="notLoggedInDiv" runat="server" class="StatusRibbon" visible="false">
                You must <asp:LinkButton runat="Server" ID="gotoLoginLink" OnClick="GotoLogin_Click">login</asp:LinkButton> to post comments.
             </div>
             <asp:Repeater runat="server" ID="commentsRepeater" OnItemCommand="CommentItem_Command">
                <HeaderTemplate>
                    <ul>
                </HeaderTemplate>
                <ItemTemplate>
                    <li>
                        <dl>
                            <dt>Picture</dt>
                            <dd><a href="<%#System.String.Format("Person.aspx?id={0}", ((Decav.Gatsb.PostComment)Container.DataItem).Owner.Id) %>"><gatsb:UserImage
                            runat="server" Size="Thumbnail" ImageId="<%# ((Decav.Gatsb.PostComment)Container.DataItem).Owner.Id %>" /></a></dd>
                            
                            <dt>Name</dt>
                            <dd class="Name"><a href="<%#System.String.Format("Person.aspx?id={0}", ((Decav.Gatsb.PostComment)Container.DataItem).Owner.Id) %>"><%# Eval("Owner.Name") %></a></dd>
                            
                            <dt>When</dt>
                            <dd><%# Decav.Gatsb.StringFormatting.ToTimeAgo(((Decav.Gatsb.PostComment)Container.DataItem).CreateDate) %></dd>
                        </dl>
                        <blockquote>
                            <p>
                                <%# Eval("Body") %>
                            </p>
                        </blockquote>
                        <ul class="Menu" runat="server" visible="<%# UserCanEditComment(((Decav.Gatsb.PostComment)Container.DataItem).Owner.Id) %>">
                            <li><asp:LinkButton runat="server" ID="deleteCommentButton" CommandName="DeleteComment" CommandArgument="<%# ((Decav.Gatsb.PostComment)Container.DataItem).Id %>">Delete Comment</asp:LinkButton></li>
                        </ul>
                        <div style="clear:left"></div>
                    </li>
                </ItemTemplate>
                <FooterTemplate>
                    </ul>
                </FooterTemplate>
             </asp:Repeater>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="submitCommentButton" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="commentsRepeater" EventName="ItemCommand" />
                </Triggers>
             </asp:UpdatePanel>
         </div>
     </div>
</asp:Content>

